<?php

class BaseController extends Zend_Controller_Action
{
    public function init() {
        $this->view->user = $this->getLoggedUser();
        $obj = new Application_Model_Permissao();
        if ($this->view->user <> null){
        $this->view->permissoes = $obj->getArrayPermissoes($this->view->user->perfil_id);
        }
        
    }

    public function getLoggedUser() {
        return Zend_Auth::getInstance()->getIdentity();        
    }
    
    public function postDispatch(){
    	$this->view->messages = $this->_helper->flashMessenger->getMessages();
    }
}